<template>
  <div class="weui-cells">
    <div class="weui-cell weui-cell_access" @click.stop.prevent="handleClickWangShangItem">
      <div class="weui-cell__hd"><svg-icon class="merchant" icon-class="wangshang" width="18px" height="19px"></svg-icon></div>
      <div class="weui-cell__bd weui-cell_primary">
        <p class="pl10">网商银行支付通道<span class="fr" :class="ws === 100 || ws === 100 || ws === 0 ? 'tip' : ws === 200 || ws === 500  ? 'succ' : ws === -200 || ws === -110 || ws === -100 || ws === 313 || ws === 913 ? 'err' : ''">{{ ws === -200 ? '审核未通过' : ws === -100 ? '入驻失败' : ws ===  0 ? '资料提审' : ws === 101 ? '已初审，待入驻' : ws === 100 ? '入驻中' : ws === -110 ? '入驻失败' : ws === 200 ? '已入驻' : ws === 311 ? '等待配置支付通道' : ws === 312 ? '部分支付通道配置成功' : ws === 313 ? '支付通道配置失败' : ws === 310 ? '支付通道配置成功' : ws === 500 ? '完成' : ws === 900 ? '申请修改信息' : ws === 901 ? '信息修改中' : ws === 910 ? '申请修改费率' : ws === 911 ? '费率修改中' : ws === 912 ? '费率修改完成' : ws === 913 ? '费率修改失败' : ws === '' ? '未提交' : '无' }}</span></p>
      </div>
      <span class="weui-cell__ft"></span>
    </div>
    <div class="weui-cell weui-cell_access" @click.stop.prevent="handleClickLeShuaItem">
      <div class="weui-cell__hd"><svg-icon class="merchant" icon-class="leshua" width="18px" height="19px"></svg-icon></div>
      <div class="weui-cell__bd weui-cell_primary">
        <p class="pl10">乐刷支付通道 <span class="fr" :class="le === 100 || le === 100 || le === 0 ? 'tip' : le === 200 || le === 500  ? 'succ' : le === -200 || le === -110 || le === -100 || le === 313 || le === 913 ? 'err' : ''">{{ le === -200 ? '审核未通过' : le === -100 ? '入驻失败' : le ===  0 ? '资料提审' : le === 101 ? '已初审，待入驻' : le === 100 ? '入驻中' : le === -110 ? '入驻失败' : le === 200 ? '已入驻' : le === 311 ? '等待配置支付通道' : le === 312 ? '部分支付通道配置成功' : le === 313 ? '支付通道配置失败' : le === 310 ? '支付通道配置成功' : le === 500 ? '完成' : le === 900 ? '申请修改信息' : le === 901 ? '信息修改中' : le === 910 ? '申请修改费率' : le === 911 ? '费率修改中' : le === 912 ? '费率修改完成' : le === 913 ? '费率修改失败' : le === '' ? '未提交' : '无' }}</span></p>
      </div>
      <span class="weui-cell__ft"></span>
    </div>
  </div>
</template>

<script>
import { salemanChnnelList } from '@/api/salesman'

export default {
  data() {
    return {
      le: null,
      ws: null
    }
  },
  methods: {
    handleClickLeShuaItem() {
      if (this.le === -100 || this.le === -200 || this.le === -110 || this.le === 313 || this.le === 913 || this.le === '') {
        this.$router.push({ name: 'channel_le', query: { status: this.le, merchant_num: this.$route.query.merchant_num }})
      } else {
        this.$router.push({ name: 'leInfo', query: { status: this.le, merchant_num: this.$route.query.merchant_num }})
      }
    },
    handleClickWangShangItem(status, merchant_num) {
      if (this.ws === -100 || this.ws === -200 || this.ws === -110 || this.ws === 313 || this.ws === 913 || this.ws === '') {
        this.$router.push({ name: 'channel_ws', query: { status: this.ws, merchant_num: this.$route.query.merchant_num }})
      } else {
        this.$router.push({ name: 'channelValid', query: { status: this.ws, merchant_num: this.$route.query.merchant_num }})
      }
    },
    handleDocumentInit() {
      salemanChnnelList(this.$route.query.merchant_num).then(res => {
        if (res.data.errorCode === 0) {
          this.le = res.data.result.lepos_channel_status
          this.ws = res.data.result.ws_channel_status
        } else {
          this.$weui.alert('数据获取失败！')
        }
      })
    }
  },
  created() {
    this.handleDocumentInit()
  }
}
</script>